const states = []
const setters = []

// 当前坐标
let cursor = 0

function createSetter(cursor) {
    return function (newValue) {
        console.log(cursor,'cursor');
        states[cursor] = newValue;
    }
}

function useState(value) {
    const defineValue = Object.defineProperty()
    states.push(value);
    setters.push(createSetter(cursor));
    return [states[cursor],setters[cursor++]]
}

const [index,setIndex] = useState(0)

console.log(index)
setIndex(10)
console.log(index)